<?php
/**
 * Created by PhpStorm.
 * User: lee
 * Date: 2018/1/9
 * Time: 下午4:04
 */

namespace Biz\service;

use Biz\model\OperateLog as mOperateLog;

/**
 * @deprecated
 */
class OperateLog
{
    public static function record($type, $uid, $foreignId, $sourceData=[], $targetData=[], $adminUid = 0,$addTime='')
    {
        $data = [
            'type' => $type,
            'uid' => $uid,
            'foreign_id' => $foreignId,
            'adminuid' => $adminUid,
            'source_data' => json_encode($sourceData, JSON_UNESCAPED_UNICODE),
            'target_data' => json_encode($targetData, JSON_UNESCAPED_UNICODE),
            'addtime' => !empty($addTime)?$addTime:date('Y-m-d H:i:s'),
        ];

        mOperateLog::insert($data);
    }

    public static function getRecord($type, $foreign_id)
    {
        return mOperateLog::get("*", [
            'type' => $type,
            'foreign_id' => $foreign_id
        ]);
    }
}